package interpreter;
import java.math.BigDecimal;


public class Id extends Expr{
	
	private Character v;
	
	private Id(char symbol)
	{
		this.v = symbol;
	}
	
	public static Id _(char c){
		return new Id(c);
	}

	public Character getV() {
		return v;
	}

	@Override
	public BigDecimal evaluate(Env env) throws Exception{
		BigDecimal bd = null;
		try{
			bd = env.get(this.v).evaluate(env);
		}catch (Exception e){
			throw new Exception("Invalid Id for "+this.v);
		}
		return bd;
	}
	
	
}
